package com.hong.concurrent.chapter1;

/**
 * 针对多次new对象的多线程问题解决
 * 1.解决方案一加上：synchronized 同步
 *      问题会造成效率问题
 *
 */
public class SingletonObject3 {

    //对象
    private static  SingletonObject3 instance;

    private SingletonObject3(){
        //empty
    }
    //获取对象
    public synchronized static SingletonObject3 getInstance() {
        if(null==instance)
            instance = new SingletonObject3();
        return instance;
    }
}
